import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Response,
  Query,
} from '@nestjs/common';
import { QiniuService } from './qiniu.service';
import { ReviewVideoDto } from './dto/video-review.dto';
import { ApiOperation } from '@nestjs/swagger';
import { ReviewTextDto } from './dto/text-review.dto';
import { Public } from 'src/common/decorators/public';
import { VideoInfoDto } from './dto/video-Info.dto';

@Controller('qiniu')
export class QiniuController {
  constructor(private readonly qiniuService: QiniuService) {}

  /**
   * @description 视频审核
   */
  @Post('videoReview')
  @ApiOperation({ summary: '七牛云视频审核测试接口' })
  videoReview(@Body() reviewVideoDto: ReviewVideoDto) {
    return this.qiniuService.censorVideo(
      reviewVideoDto.key,
      Number(reviewVideoDto.videoId),
    );
  }

  /**
   * @description 文本审核
   */
  @Post('textReview')
  @ApiOperation({ summary: '七牛云文本审核测试接口' })
  textReview(@Body() reviewTextDto: ReviewTextDto) {
    return this.qiniuService.censorText(reviewTextDto.text);
  }

  /**
   * @description 获取视频信息
   */
  @Get('video-info')
  @Public()
  @ApiOperation({ summary: '获取七牛云视频元信息' })
  async getVideoInfo(@Query() videoInfoDto: VideoInfoDto) {
    return this.qiniuService.getVideoInfo(videoInfoDto.key);
  }
}
